package com.eshore;
import java.sql.*;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import com.mysql.jdbc.Statement;
public class JDBCutils {
private static String driver="com.mysql.jdbc.Driver";
static {
	try 
	{
		Class.forName(driver);
	}
	catch(ClassNotFoundException e) 
	{
		e.printStackTrace();
	}
}
private static Connection conn=null;
public static Connection getConnection(String url,String user,String password) throws Exception{
	conn=DriverManager.getConnection(url,user,password);
	return conn;
}
public static void closeStament(ResultSet rs,Statement st,Connection conn) {
	if(rs!=null)
	{
		try 
		{
		rs.close();
	}
		catch (SQLException e) 
		{
		e.printStackTrace();
	}
}
	if(st!=null)
	{
		try 
		{
		st.close();
	}
		catch (SQLException e) 
		{
		e.printStackTrace();
	}
}
	if(conn!=null) 
	{
		try 
		{
		conn.close();
	}
		catch (SQLException e)
{
		e.printStackTrace();
	}
	}
}
}
